<template>
  <div class="test">
    <h2>父组件</h2>
    <child></child>
    <hr />
    <child>
      <!-- 外层可以是任意的标签 -->
      <template slot-scope="scope">
        <span
          style="color: red"
          v-if="scope.item === 'green'"
        >
          {{ scope.item }}</span
        >
        <span v-else> {{ scope.item }}</span>
      </template>
    </child>
  </div>
</template>
<script>
import Child from './Child.vue'
export default {
  data() {
    return {}
  },
  components: {
    Child
  }
}
</script>
<style lang="scss" scoped></style>
